package com.j4dream.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.j4dream.Entity.DetailItemDBVO;
import com.j4dream.jizhang.R;
import com.j4dream.repo.DetailRepo;


public class AddDetailItemActivity extends Activity {

    private EditText edit_money =null;
    private EditText type=null;
    private EditText time=null;

    private Button save_btn=null;

    private DetailItemDBVO data=new DetailItemDBVO();

    private DetailRepo repo=new DetailRepo();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_add_detail_item);

        edit_money =(EditText)findViewById(R.id.add_detail_item_edi_money);
        type=(EditText)findViewById(R.id.add_detail_item_edi_Type);
        time=(EditText)findViewById(R.id.add_detail_item_edi_time);

        save_btn=(Button)findViewById(R.id.add_detail_item_btn_save);
        save_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                data.setMoney(Double.parseDouble(edit_money.getText().toString()));
                data.setType(type.getText().toString());
                data.setTime(time.getText().toString());
                save_btn=(Button)findViewById(R.id.add_detail_item_btn_save);
                repo.saveDetailItem(data);
            }
        });


    }

}
